package com.hz.house.common;

import com.hz.house.enums.ResultCodeEnum;

/**
 * 封装统一返回结果模板
 * @author lfw
 *
 */
public class ResultUtil {

	public static ResultBean ok() {
		return new ResultBean(ResultCodeEnum.OK.code(), "success", null);
	}
	public static ResultBean ok(String msg) {
		return new ResultBean(ResultCodeEnum.OK.code(),msg, null);
	}
	public static ResultBean ok(Object data) {
		return new ResultBean(ResultCodeEnum.OK.code(),"success", data);
	}
	public static ResultBean ok(String msg,Object data) {
		return new ResultBean(ResultCodeEnum.OK.code(),"success", data);
	}
	
	public static ResultBean fail(String msg) {
		return new ResultBean(ResultCodeEnum.SERVICE_ERROR.code(), msg, null);
	}
	public static ResultBean serverError() {
		return new ResultBean(ResultCodeEnum.SERVER_INTERNAL_ERROR.code(), "服务异常,稍后再试", null);
	}
	
}
